Ext.define('PJ.view.evaluationprogress.AssessProgressList', {
    extend: 'AM.default.DefaultList',
    alias: ['widget.assessProgressList'],
    requires: ['PJ.view.evaluationprogress.CourseUserList'],
    selModel: {
        selType: '',
        checkOnly: true
    },
    initComponent: function(){
    	var me = this;
        me.columns = [{
            header: '课程问卷名称',
            dataIndex: 'courseName',
            flex: 1,
            minWidth: 120,
			renderer: function(value, metaData, record){
				metaData.tdAttr = 'data-qtip="' + value + '"';
				return value;
			}
        }/*, {
            header: '课程编号',
            dataIndex: 'courseNum',
            width: 130,
			renderer: function(value, metaData, record){
				metaData.tdAttr = 'data-qtip="' + value + '"';
				return value;
			}
        }*/, {
            header: '已评估人数',
            dataIndex: 'answerUser',
            width: 80,
            renderer: function(value, meta, record){
            	var m=record.get("questionnaireMethod");
            	if(m==1&&value!=0)
            		meta.style = "overflow: hidden;text-overflow: ellipsis;cursor: pointer;color: blue;";
            	meta.tdAttr = 'data-qtip="' + value + '" courseId=' + record.get("courseId") + ' questionnaireId="' + record.get("questionnaireId") + '" questionnaireMethod="' + record.get("questionnaireMethod") + '"';
            	return value;
            },
            listeners: {
                click: function(g, clm){
                	var m=clm.getAttribute("questionnaireMethod");
                	var count=clm.getAttribute('data-qtip');
                	if(m==1&&count!=0){
                		Ext.create('AM.default.DefaultWindowView', {
                			title: "查看人员信息",
                			grid: g,
                			courseId: clm.getAttribute("courseId"),
                			answerUserStatus: 1,
                			questionnaireId: clm.getAttribute("questionnaireId"),
                			width: 700,
                			height: 400,
                			items: [{
                				xtype: 'courseUserList'
                			}]
                		}).show();
                	}
                }
            }
        }, {
            header: '未评估人数',
            dataIndex: 'noAnswerUser',
            width: 80,
            renderer: function(value, meta, record){
            	var m=record.get("questionnaireMethod");
            	if(m==1&&value!=0)
        			meta.style = "overflow: hidden;text-overflow: ellipsis;cursor: pointer;color: blue;";
                meta.tdAttr = 'data-qtip="' + value + '" courseId=' + record.get("courseId") + ' questionnaireId="' + record.get("questionnaireId") + '" questionnaireMethod="' + record.get("questionnaireMethod") + '"';
                return value;
            },
            listeners: {
                click: function(g, clm){
                	var m=clm.getAttribute("questionnaireMethod");
                	var count=clm.getAttribute('data-qtip');
                	if(m==1&&count!=0){
                		Ext.create('AM.default.DefaultWindowView', {
                			title: "查看人员信息",
                			grid: g,
                			courseId: clm.getAttribute("courseId"),
                			answerUserStatus: 2,
                			questionnaireId: clm.getAttribute("questionnaireId"),
                			width: 700,
                			height: 400,
                			items: [{
                				xtype: 'courseUserList'
                			}]
                		}).show();
                	}
                }
            }
        }, {
            header: '参评率(%)',
            dataIndex: 'nswerPerc',
            width: 70,
            renderer: function(value, metaData, record){
                return value;
            }
        }];
        me.store = Ext.create('PJ.store.evaluationprogress.AssessProgressList', {
            isLoad: false
        });
        this.loadType = gj_onlineLearning_constant.loadType;//加载方式
        me.callParent(arguments);
    },
    //导出
    onExportClick: function(){
    	var me = this;
        var store = me.getStore();
        var params=store.proxy.extraParams;
        var href=me.store.exportUrl + "?page=-1";
        for(var param in params){
        	if(params[param] === undefined){
        		href+="&"+param+"=";
        	}else{
        		href+="&"+param+"="+params[param];
        	}
        }
        href = encodeURI(href);
        var atag = Ext.get("exportResume");
        atag.set({
            "href": href
        });
        atag.dom.click();
    },
    listeners: {
    	viewready: function(){
    		var me = this;
    		me.addDocked([{
                xtype: 'toolbar',
                dock: 'top',
                displayInfo: true,
                items: [{
                    text: '导出',
                    iconCls: 'deriveIco',
                    itemId: this.oldId + "Export",
                    disabled: false,
                    scope: this,
                    handler: this.onExportClick
                }]
            }]);
            var store = me.store;
            var params = store.proxy.extraParams;
            var newParams = {
            	searchClassId: me.up('window').classId
            };
            Ext.apply(params, newParams);
            store.isLoad = true;
            store.load();
    		// 触发权限过滤事件
    		this.fireEvent("permission", this);
    	}
    }
});

